import {post_json,get,post} from '../../http/axios'
export default{
    namespaced:true,
    state:{
        orderInfo:[],
        orderWait:[],
        orderReceive:[],
        orderConfirm:[],
        orderOver:[],
        details:[]
    },
    getters:{},
    mutations:{
        setOrderInfo(state,data){
            state.orderInfo = data
        },
        setOrderWait(state,data){
            state.orderWait = data
        },
        setOrderReceive(state,data){
            state.orderReceive = data
        },
        setOrderConfirm(state,data){
            state.orderConfirm = data
        },
        setOrderOver(state,data){
            state.orderOver = data
        },
        setdetails(state,data){
            state.details = data
        },
    },
    actions:{
        async finddetails(context,params){
            let res = await get('/order/findById?id='+params)
            context.commit('setdetails',res.data)
        },
        async loadOrderOver(context,params){
            let res = await get('/order/query?'+params)
            context.commit('setOrderOver',res.data);
        },
        async loadOrderConfirm(context,params){
            let res = await get('/order/query?'+params)
            context.commit('setOrderConfirm',res.data);
        },
        async loadOrderReceive(context,params){
            let res = await get('/order/query?'+params)
            context.commit('setOrderReceive',res.data);
        },
        async loadOrderWait(context,params){
            let res = await get('/order/query?'+params)
            context.commit('setOrderWait',res.data);
        },
        async loadOrderInfo(context,params){
            let res = await get('/order/query?waiterId='+params)
            context.commit('setOrderInfo',res.data);
        }
    }
}